#include<bits/stdc++.h>
using namespace std;

int a[12][12];

int main()
{
	int n;
	cin>>n;
	int k = 1;
	for(int i = 1;i <= n/2;i++)
	{
		for(int j = i;j <= n-i+1;j++)
			a[j][n-i+1] = k++;
		for(int j = n-i;j >= i;j--)
			a[n-i+1][j] = k++;
		for(int j = n-i;j >= i;j--)
			a[j][i] = k++;
		for(int j = i+1;j <= n-i;j++)
			a[i][j] = k++;
	}
	if(n % 2)
		a[n/2+1][n/2+1] = n*n;
	for(int i = 1;i <= n;i++)
	{
		for(int j = 1;j <= n;j++)
			cout<<a[i][j]<<" ";
		cout<<endl;
	}
    return 0;
}

